<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>NeuZephyr: D:/Users/Mgepahmge/Documents/C Program/NeuZephyr/include/NeuZephyr/MappedTensor.cuh Source File</title>
<link rel="icon" href="NZ_logo2.png" type="image/x-icon" />
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="NZ_logo2.png"/></td>
  <td id="projectalign">
   <div id="projectname">NeuZephyr
   </div>
   <div id="projectbrief">Simple DL Framework</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){ initResizable(false); });
/* @license-end */
</script>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d522931ffa1371640980b621734a4381.html">Users</a></li><li class="navelem"><a class="el" href="dir_a7e6ee1ae3f772c9504a0b543f2027e2.html">Mgepahmge</a></li><li class="navelem"><a class="el" href="dir_e03f57e346cc4845a4c354a35630b169.html">Documents</a></li><li class="navelem"><a class="el" href="dir_231a0482af2b83c895f27ba7fe745141.html">C Program</a></li><li class="navelem"><a class="el" href="dir_0fa7fc3a0dfd304dbfc9dce9f6facfa2.html">NeuZephyr</a></li><li class="navelem"><a class="el" href="dir_e7295b03dab2e9cdf32139bd8ec2e607.html">include</a></li><li class="navelem"><a class="el" href="dir_657344ecc65cfc28732701509f8d8421.html">NeuZephyr</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="headertitle"><div class="title">MappedTensor.cuh</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="preprocessor">#ifndef MAPPEDTENSOR_CUH</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno">    2</span><span class="preprocessor">#define MAPPEDTENSOR_CUH</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno">    3</span><span class="preprocessor">#include &lt;stdexcept&gt;</span></div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno">    4</span><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno">    5</span><span class="preprocessor">#include &quot;dl_export.cuh&quot;</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno">    6</span><span class="preprocessor">#include &quot;Dimension.cuh&quot;</span></div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno">    7</span> </div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="keyword">namespace </span><a class="code hl_namespace" href="namespacenz_1_1data.html">nz::data</a> {</div>
<div class="foldopen" id="foldopen00066" data-start="{" data-end="};">
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"><a class="line" href="classnz_1_1data_1_1_mapped_tensor.html">   66</a></span>    <span class="keyword">class </span>DL_API <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a> {</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span>    <span class="keyword">public</span>:</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span>        <span class="keyword">using </span>size_type = <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> long;</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span>        <span class="keyword">using </span>value_type = float;</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span>        <span class="keyword">using </span><a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">shape_type</a> = <a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">Dimension</a>;</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span>        <span class="keyword">using </span>iterator = value_type*;</div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span> </div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span>        <span class="keyword">friend</span> DL_API std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, <span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp; tensor);</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span>        <span class="keyword">friend</span> DL_API std::istream&amp; operator&gt;&gt;(std::istream&amp; is, <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp; tensor);</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span> </div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno">   78</span> </div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno">  101</span>        <span class="keyword">explicit</span> <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">shape_type</a>&amp; shape, <span class="keywordtype">bool</span> requires_grad = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno">  102</span> </div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno">  122</span>        <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>();</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno">  123</span> </div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno">  148</span>        <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp; other);</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno">  149</span> </div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno">  171</span>        <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>(<a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp;&amp; other) <span class="keyword">noexcept</span>;</div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno">  172</span> </div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno">  198</span>        <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp; operator=(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp; other);</div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno">  199</span> </div>
<div class="line"><a id="l00225" name="l00225"></a><span class="lineno">  225</span>        <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp; operator=(<a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp;&amp; other) <span class="keyword">noexcept</span>(<span class="keyword">false</span>);</div>
<div class="line"><a id="l00226" name="l00226"></a><span class="lineno">  226</span> </div>
<div class="line"><a id="l00252" name="l00252"></a><span class="lineno">  252</span>        <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">~MappedTensor</a>() <span class="keyword">noexcept</span>(<span class="keyword">false</span>);</div>
<div class="line"><a id="l00254" name="l00254"></a><span class="lineno">  254</span> </div>
<div class="line"><a id="l00257" name="l00257"></a><span class="lineno">  257</span> </div>
<div class="line"><a id="l00281" name="l00281"></a><span class="lineno">  281</span>        [[nodiscard]] iterator begin() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00282" name="l00282"></a><span class="lineno">  282</span> </div>
<div class="line"><a id="l00306" name="l00306"></a><span class="lineno">  306</span>        [[nodiscard]] iterator end() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00307" name="l00307"></a><span class="lineno">  307</span> </div>
<div class="line"><a id="l00331" name="l00331"></a><span class="lineno">  331</span>        [[nodiscard]] <span class="keywordtype">bool</span> requiresGrad() <span class="keyword">const</span> <span class="keyword">noexcept</span>;</div>
<div class="line"><a id="l00332" name="l00332"></a><span class="lineno">  332</span> </div>
<div class="line"><a id="l00357" name="l00357"></a><span class="lineno">  357</span>        [[nodiscard]] value_type* data() <span class="keyword">const</span> <span class="keyword">noexcept</span>;</div>
<div class="line"><a id="l00358" name="l00358"></a><span class="lineno">  358</span> </div>
<div class="line"><a id="l00400" name="l00400"></a><span class="lineno">  400</span>        [[nodiscard]] value_type* grad() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00401" name="l00401"></a><span class="lineno">  401</span> </div>
<div class="line"><a id="l00425" name="l00425"></a><span class="lineno">  425</span>        [[nodiscard]] size_type size() <span class="keyword">const</span> <span class="keyword">noexcept</span>;</div>
<div class="line"><a id="l00426" name="l00426"></a><span class="lineno">  426</span> </div>
<div class="line"><a id="l00450" name="l00450"></a><span class="lineno">  450</span>        [[nodiscard]] <a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">shape_type</a> shape() <span class="keyword">const</span> <span class="keyword">noexcept</span>;</div>
<div class="line"><a id="l00451" name="l00451"></a><span class="lineno">  451</span> </div>
<div class="line"><a id="l00482" name="l00482"></a><span class="lineno">  482</span>        <span class="keywordtype">void</span> setRequiresGrad(<span class="keywordtype">bool</span> requires_grad);</div>
<div class="line"><a id="l00483" name="l00483"></a><span class="lineno">  483</span> </div>
<div class="line"><a id="l00517" name="l00517"></a><span class="lineno">  517</span>        <span class="keywordtype">void</span> setShape(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_dimension.html">shape_type</a>&amp; shape);</div>
<div class="line"><a id="l00518" name="l00518"></a><span class="lineno">  518</span> </div>
<div class="line"><a id="l00554" name="l00554"></a><span class="lineno">  554</span>        <span class="keywordtype">void</span> dataInject(<span class="keywordtype">float</span>* data, size_type size, <span class="keywordtype">bool</span> isGrad = <span class="keyword">false</span>) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00555" name="l00555"></a><span class="lineno">  555</span> </div>
<div class="line"><a id="l00589" name="l00589"></a><span class="lineno">  589</span>        <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Iterator&gt;</div>
<div class="foldopen" id="foldopen00590" data-start="{" data-end="}">
<div class="line"><a id="l00590" name="l00590"></a><span class="lineno"><a class="line" href="classnz_1_1data_1_1_mapped_tensor.html#a7f5550020dbf34ae87f208c22a73e28d">  590</a></span>        <span class="keywordtype">void</span> <a class="code hl_function" href="classnz_1_1data_1_1_mapped_tensor.html#a7f5550020dbf34ae87f208c22a73e28d">dataInject</a>(Iterator begin, Iterator end, <span class="keyword">const</span> <span class="keywordtype">bool</span> isGrad = <span class="keyword">false</span>)<span class="keyword"> const </span>{</div>
<div class="line"><a id="l00591" name="l00591"></a><span class="lineno">  591</span>            <span class="keywordflow">if</span> (isGrad &amp;&amp; !_requires_grad) {</div>
<div class="line"><a id="l00592" name="l00592"></a><span class="lineno">  592</span>                <span class="keywordflow">throw</span> std::invalid_argument(<span class="stringliteral">&quot;Tensor does not require gradients&quot;</span>);</div>
<div class="line"><a id="l00593" name="l00593"></a><span class="lineno">  593</span>            }</div>
<div class="line"><a id="l00594" name="l00594"></a><span class="lineno">  594</span>            <span class="keyword">auto</span> size = std::distance(begin, end);</div>
<div class="line"><a id="l00595" name="l00595"></a><span class="lineno">  595</span>            <span class="keyword">auto</span> it = begin;</div>
<div class="line"><a id="l00596" name="l00596"></a><span class="lineno">  596</span>            <span class="keywordflow">for</span> (size_type i = 0; i &lt; (size &lt; _size ? size : _size) &amp;&amp; it != end; ++i, ++it) {</div>
<div class="line"><a id="l00597" name="l00597"></a><span class="lineno">  597</span>                <span class="keywordflow">if</span> (isGrad) {</div>
<div class="line"><a id="l00598" name="l00598"></a><span class="lineno">  598</span>                    _grad[i] = <span class="keyword">static_cast&lt;</span>value_type<span class="keyword">&gt;</span>(*it);</div>
<div class="line"><a id="l00599" name="l00599"></a><span class="lineno">  599</span>                }</div>
<div class="line"><a id="l00600" name="l00600"></a><span class="lineno">  600</span>                <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00601" name="l00601"></a><span class="lineno">  601</span>                    _data[i] = <span class="keyword">static_cast&lt;</span>value_type<span class="keyword">&gt;</span>(*it);</div>
<div class="line"><a id="l00602" name="l00602"></a><span class="lineno">  602</span>                }</div>
<div class="line"><a id="l00603" name="l00603"></a><span class="lineno">  603</span>            }</div>
<div class="line"><a id="l00604" name="l00604"></a><span class="lineno">  604</span>        }</div>
</div>
<div class="line"><a id="l00605" name="l00605"></a><span class="lineno">  605</span> </div>
<div class="line"><a id="l00634" name="l00634"></a><span class="lineno">  634</span>        <span class="keywordtype">void</span> dataInject(<span class="keyword">const</span> std::initializer_list&lt;value_type&gt;&amp; data, <span class="keyword">const</span> <span class="keywordtype">bool</span> isGrad = <span class="keyword">false</span>) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00635" name="l00635"></a><span class="lineno">  635</span> </div>
<div class="line"><a id="l00665" name="l00665"></a><span class="lineno">  665</span>        <span class="keyword">auto</span> operator[](size_type index) <span class="keyword">const</span> -&gt; value_type&amp;;</div>
<div class="line"><a id="l00667" name="l00667"></a><span class="lineno">  667</span> </div>
<div class="line"><a id="l00670" name="l00670"></a><span class="lineno">  670</span> </div>
<div class="line"><a id="l00697" name="l00697"></a><span class="lineno">  697</span>        std::ostream&amp; print(std::ostream&amp; os) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00698" name="l00698"></a><span class="lineno">  698</span> </div>
<div class="line"><a id="l00727" name="l00727"></a><span class="lineno">  727</span>        std::ostream&amp; printGrad(std::ostream&amp; os) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00729" name="l00729"></a><span class="lineno">  729</span> </div>
<div class="line"><a id="l00732" name="l00732"></a><span class="lineno">  732</span> </div>
<div class="line"><a id="l00764" name="l00764"></a><span class="lineno">  764</span>        <span class="keywordtype">void</span> clear() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00765" name="l00765"></a><span class="lineno">  765</span> </div>
<div class="line"><a id="l00801" name="l00801"></a><span class="lineno">  801</span>        <span class="keywordtype">void</span> clearGrad() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00802" name="l00802"></a><span class="lineno">  802</span> </div>
<div class="line"><a id="l00836" name="l00836"></a><span class="lineno">  836</span>        <span class="keywordtype">void</span> reshape(<span class="keyword">const</span> shape_type&amp; shape);</div>
<div class="line"><a id="l00837" name="l00837"></a><span class="lineno">  837</span> </div>
<div class="line"><a id="l00876" name="l00876"></a><span class="lineno">  876</span>        <span class="keywordtype">void</span> randomize(size_type seed = 0, <span class="keywordtype">bool</span> isGrad = <span class="keyword">false</span>) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00877" name="l00877"></a><span class="lineno">  877</span> </div>
<div class="line"><a id="l00908" name="l00908"></a><span class="lineno">  908</span>        <span class="keywordtype">void</span> fill(value_type value, <span class="keywordtype">bool</span> isGrad = <span class="keyword">false</span>) <span class="keyword">const</span>;</div>
<div class="line"><a id="l00909" name="l00909"></a><span class="lineno">  909</span> </div>
<div class="line"><a id="l00958" name="l00958"></a><span class="lineno">  958</span>        <span class="keywordtype">void</span> fillMatrix(value_type value, size_type batch, size_type channels, <span class="keywordtype">bool</span> isGrad = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00959" name="l00959"></a><span class="lineno">  959</span> </div>
<div class="line"><a id="l00992" name="l00992"></a><span class="lineno">  992</span>        <span class="keywordtype">void</span> <a class="code hl_function" href="namespacenz_1_1data.html#ac8d64dd271e9a2e50682e733bd14ec19">transpose</a>();</div>
<div class="line"><a id="l00994" name="l00994"></a><span class="lineno">  994</span> </div>
<div class="line"><a id="l00997" name="l00997"></a><span class="lineno">  997</span> </div>
<div class="line"><a id="l01030" name="l01030"></a><span class="lineno"> 1030</span>        <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a> <a class="code hl_function" href="namespacenz_1_1data.html#ab99b7c0a7c96a6de43f5b3f25af7f918">operator+</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01031" name="l01031"></a><span class="lineno"> 1031</span> </div>
<div class="line"><a id="l01064" name="l01064"></a><span class="lineno"> 1064</span>        <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a> <a class="code hl_function" href="namespacenz_1_1data.html#acc650ae262aba5f1b0fa9cca8cae311e">operator-</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01065" name="l01065"></a><span class="lineno"> 1065</span> </div>
<div class="line"><a id="l01099" name="l01099"></a><span class="lineno"> 1099</span>        <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a> <a class="code hl_function" href="namespacenz_1_1data.html#a8730252e35a8e59aacb429efb0d6b828">operator*</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01100" name="l01100"></a><span class="lineno"> 1100</span> </div>
<div class="line"><a id="l01129" name="l01129"></a><span class="lineno"> 1129</span>        <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a> <a class="code hl_function" href="namespacenz_1_1data.html#acc650ae262aba5f1b0fa9cca8cae311e">operator-</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01130" name="l01130"></a><span class="lineno"> 1130</span> </div>
<div class="line"><a id="l01167" name="l01167"></a><span class="lineno"> 1167</span>        <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01168" name="l01168"></a><span class="lineno"> 1168</span> </div>
<div class="line"><a id="l01199" name="l01199"></a><span class="lineno"> 1199</span>        <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01200" name="l01200"></a><span class="lineno"> 1200</span> </div>
<div class="line"><a id="l01234" name="l01234"></a><span class="lineno"> 1234</span>        <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a> <a class="code hl_function" href="namespacenz_1_1data.html#a771a257e9dd839ce330e9b40fd1dda56">operator/</a>(<span class="keyword">const</span> <a class="code hl_class" href="classnz_1_1data_1_1_mapped_tensor.html">MappedTensor</a>&amp; other) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01235" name="l01235"></a><span class="lineno"> 1235</span> </div>
<div class="line"><a id="l01263" name="l01263"></a><span class="lineno"> 1263</span>        <span class="keywordtype">void</span> recip();</div>
<div class="line"><a id="l01264" name="l01264"></a><span class="lineno"> 1264</span> </div>
<div class="line"><a id="l01297" name="l01297"></a><span class="lineno"> 1297</span>        [[nodiscard]] value_type sum() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01298" name="l01298"></a><span class="lineno"> 1298</span> </div>
<div class="line"><a id="l01336" name="l01336"></a><span class="lineno"> 1336</span>        [[nodiscard]] value_type sum(<span class="keywordtype">size_t</span> batch, <span class="keywordtype">size_t</span> channel) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01337" name="l01337"></a><span class="lineno"> 1337</span> </div>
<div class="line"><a id="l01370" name="l01370"></a><span class="lineno"> 1370</span>        [[nodiscard]] value_type expSum() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01371" name="l01371"></a><span class="lineno"> 1371</span> </div>
<div class="line"><a id="l01419" name="l01419"></a><span class="lineno"> 1419</span>        [[nodiscard]] value_type expSum(<span class="keywordtype">size_t</span> batch, <span class="keywordtype">size_t</span> channel) <span class="keyword">const</span>;</div>
<div class="line"><a id="l01420" name="l01420"></a><span class="lineno"> 1420</span> </div>
<div class="line"><a id="l01442" name="l01442"></a><span class="lineno"> 1442</span>        <span class="keywordtype">void</span> syncGrad() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01443" name="l01443"></a><span class="lineno"> 1443</span> </div>
<div class="line"><a id="l01467" name="l01467"></a><span class="lineno"> 1467</span>        <span class="keywordtype">void</span> syncData() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01468" name="l01468"></a><span class="lineno"> 1468</span> </div>
<div class="line"><a id="l01492" name="l01492"></a><span class="lineno"> 1492</span>        <span class="keywordtype">void</span> sync() <span class="keyword">const</span>;</div>
<div class="line"><a id="l01494" name="l01494"></a><span class="lineno"> 1494</span> </div>
<div class="line"><a id="l01495" name="l01495"></a><span class="lineno"> 1495</span>    <span class="keyword">private</span>:</div>
<div class="line"><a id="l01496" name="l01496"></a><span class="lineno"> 1496</span>        size_type _size;</div>
<div class="line"><a id="l01497" name="l01497"></a><span class="lineno"> 1497</span>        shape_type _shape;</div>
<div class="line"><a id="l01498" name="l01498"></a><span class="lineno"> 1498</span>        value_type* _data;</div>
<div class="line"><a id="l01499" name="l01499"></a><span class="lineno"> 1499</span>        value_type* _grad;</div>
<div class="line"><a id="l01500" name="l01500"></a><span class="lineno"> 1500</span>        <span class="keywordtype">bool</span> _requires_grad;</div>
<div class="line"><a id="l01501" name="l01501"></a><span class="lineno"> 1501</span>    };</div>
</div>
<div class="line"><a id="l01502" name="l01502"></a><span class="lineno"> 1502</span>}</div>
<div class="line"><a id="l01503" name="l01503"></a><span class="lineno"> 1503</span><span class="preprocessor">#endif </span><span class="comment">//MAPPEDTENSOR_CUH</span></div>
<div class="ttc" id="aclassnz_1_1data_1_1_dimension_html"><div class="ttname"><a href="classnz_1_1data_1_1_dimension.html">nz::data::Dimension</a></div><div class="ttdoc">Represents a multi - dimensional shape, typically used in deep learning for tensor dimensions.</div><div class="ttdef"><b>Definition</b> <a href="_dimension_8cuh_source.html#l00057">Dimension.cuh:57</a></div></div>
<div class="ttc" id="aclassnz_1_1data_1_1_mapped_tensor_html"><div class="ttname"><a href="classnz_1_1data_1_1_mapped_tensor.html">nz::data::MappedTensor</a></div><div class="ttdoc">A class for representing multidimensional arrays in CUDA zero-copy memory, providing host-accessible ...</div><div class="ttdef"><b>Definition</b> <a href="#l00066">MappedTensor.cuh:66</a></div></div>
<div class="ttc" id="aclassnz_1_1data_1_1_mapped_tensor_html_a7f5550020dbf34ae87f208c22a73e28d"><div class="ttname"><a href="classnz_1_1data_1_1_mapped_tensor.html#a7f5550020dbf34ae87f208c22a73e28d">nz::data::MappedTensor::dataInject</a></div><div class="ttdeci">void dataInject(Iterator begin, Iterator end, const bool isGrad=false) const</div><div class="ttdoc">Inject data from an iterator range into either the tensor's data or its gradient.</div><div class="ttdef"><b>Definition</b> <a href="#l00590">MappedTensor.cuh:590</a></div></div>
<div class="ttc" id="anamespacenz_1_1data_html"><div class="ttname"><a href="namespacenz_1_1data.html">nz::data</a></div><div class="ttdoc">Contains data structures and utilities for tensor operations in machine learning workflows.</div><div class="ttdef"><b>Definition</b> <a href="_dimension_8cuh_source.html#l00009">Dimension.cuh:9</a></div></div>
<div class="ttc" id="anamespacenz_1_1data_html_a771a257e9dd839ce330e9b40fd1dda56"><div class="ttname"><a href="namespacenz_1_1data.html#a771a257e9dd839ce330e9b40fd1dda56">nz::data::operator/</a></div><div class="ttdeci">std::enable_if_t&lt; is_valid_tensor_type&lt; T &gt;::value, T &gt; operator/(T &amp;lhs, const float rhs)</div><div class="ttdoc">Overload the division operator to divide a tensor of type T by a scalar float.</div><div class="ttdef"><b>Definition</b> <a href="_tensor_operations_8cuh_source.html#l00689">TensorOperations.cuh:689</a></div></div>
<div class="ttc" id="anamespacenz_1_1data_html_a8730252e35a8e59aacb429efb0d6b828"><div class="ttname"><a href="namespacenz_1_1data.html#a8730252e35a8e59aacb429efb0d6b828">nz::data::operator*</a></div><div class="ttdeci">std::enable_if_t&lt; is_valid_tensor_type&lt; T &gt;::value, T &gt; operator*(T &amp;lhs, const float rhs)</div><div class="ttdoc">Overload the multiplication operator to multiply a tensor of type T by a scalar float.</div><div class="ttdef"><b>Definition</b> <a href="_tensor_operations_8cuh_source.html#l00604">TensorOperations.cuh:604</a></div></div>
<div class="ttc" id="anamespacenz_1_1data_html_ab99b7c0a7c96a6de43f5b3f25af7f918"><div class="ttname"><a href="namespacenz_1_1data.html#ab99b7c0a7c96a6de43f5b3f25af7f918">nz::data::operator+</a></div><div class="ttdeci">std::enable_if_t&lt; is_valid_tensor_type&lt; T &gt;::value, T &gt; operator+(T &amp;lhs, const float rhs)</div><div class="ttdoc">Overload the addition operator to add a scalar float to a tensor of type T.</div><div class="ttdef"><b>Definition</b> <a href="_tensor_operations_8cuh_source.html#l00436">TensorOperations.cuh:436</a></div></div>
<div class="ttc" id="anamespacenz_1_1data_html_ac8d64dd271e9a2e50682e733bd14ec19"><div class="ttname"><a href="namespacenz_1_1data.html#ac8d64dd271e9a2e50682e733bd14ec19">nz::data::transpose</a></div><div class="ttdeci">std::enable_if_t&lt; is_valid_tensor_type&lt; T &gt;::value, T &gt; transpose(const T &amp;in)</div><div class="ttdoc">Transposes a tensor with a valid tensor type.</div><div class="ttdef"><b>Definition</b> <a href="_tensor_operations_8cuh_source.html#l01073">TensorOperations.cuh:1073</a></div></div>
<div class="ttc" id="anamespacenz_1_1data_html_acc650ae262aba5f1b0fa9cca8cae311e"><div class="ttname"><a href="namespacenz_1_1data.html#acc650ae262aba5f1b0fa9cca8cae311e">nz::data::operator-</a></div><div class="ttdeci">std::enable_if_t&lt; is_valid_tensor_type&lt; T &gt;::value, T &gt; operator-(T &amp;lhs, const float rhs)</div><div class="ttdoc">Overload the subtraction operator to subtract a scalar float from a tensor of type T.</div><div class="ttdef"><b>Definition</b> <a href="_tensor_operations_8cuh_source.html#l00520">TensorOperations.cuh:520</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
